package com.example.demo.controller;


import com.example.demo.commons.base.BaseController;
import com.example.demo.commons.r.R;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController extends BaseController<UserService> {

    @PostMapping("/register")
    public R register(@RequestBody @Validated User user) {
        System.out.println("用户注册-{}" + user);
        return R.succ(getBaserService().save(user));
    }
}
